/**
 * @ author: 汪孟苹
 */
define(['jquery',"bbcare",
	"scprit/followup/app/patientManager/addPatientTreatment.servers.js",
	"scprit/followup/app/patientManager/addPatientTreatment.ui.js",
	"scprit/followup/app/patientManager/addPatientTreatment.event.js"
	],
	function($,$bb,$addPatientServers,$addPatientUi,$addPatientEvent){
	var addPatient = {};
	/**
	 * 请求队列成功后的回调函数
	 */
	var getQueuesCallback = function(data){
		$addPatientUi.queues({	// 队列列表
			id: "queueList",
			list: data.rows,
		});
		var topbars = [
			{
				"icon":"fa fa-times",
				"name":"关闭",
				"callback":$addPatientEvent.onCloseSelect
			}
		];
        $bb.toolbar(topbars);
		/* 点击哪个队列就渲染哪个队列的详细建档问卷 */
		$("#queueList .queue-card").unbind("click");
		$("#queueList .queue-card").click($addPatientEvent.onQueueNavSelect);
		$("#queueList .queue-card").first().click();
	}
	/**
	 * 建档页面初始化
	 */
	addPatient.init = function(){
		$addPatientServers.ajaxQueueList(getQueuesCallback);
	};

	return addPatient;
});